 
 
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>进度条 - 页面元素 - Layui</title>
<meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="apple-mobile-web-app-status-bar-style" content="black"> 
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="format-detection" content="telephone=no">
  <script>
  ;!function(){self!==parent&&(location.href="//www.baidu.com/")}();
  </script>
  <link rel="stylesheet" href="../../layui/dist/css/layui.css" media="all">
  <link rel="stylesheet" href="../../static/css/global.css" media="all">
</head>
<body><div class="layui-header header header-doc" autumn="">
  <div class="layui-container">
    <a class="logo" href="../../index.html">
      <img src="../../static/images/layui/logo.png" alt="layui">
    </a>
    <div class="layui-form layui-hide-xs component" lay-filter="LAY-site-header-component"></div>
    <div class="layui-hide-xs site-notice"></div>
    
    <ul class="layui-nav" id="LAY_NAV_TOP">
      <li class="layui-nav-item layui-this">
        <a href="../index.html">文档</a> 
      </li>
      <li class="layui-nav-item ">
        <a href="../../demo/index.html">示例</a>
      </li>
      
      <li class="layui-nav-item">
        <a href="javascript:;">
          <!--<span class="layui-badge-dot" style="left:0; right: auto; margin: -4px 0 0 5px;"></span>--> 
          周边
        </a>
        <dl class="layui-nav-child layui-nav-child-c">  
          <dd class="layui-hide-sm layui-show-xs" lay-unselect="">
            <a href="javascript:window.open('https://gitee.com/sentsin/layui/issues');" target="_blank" rel="nofollow">问题反馈</a>
            <hr>
          </dd>
          
          <dd lay-unselect=""><a href="../../alone.html" target="_blank" lay-unselect="">独立组件</a></dd>
          <dd lay-unselect=""><a href="../../extend/index.html" target="_blank">扩展组件</a></dd>
        </dl>
      </li>
      
      
    </ul>
  </div>
</div>
 
<!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
<!--[if lt IE 9]>
  <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
  <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
 
<ul class="site-dir">
  <li><a href="#default"><cite>常规用法</cite></a></li>
  <li><a href="#showPercent"><cite>显示进度比文本</cite></a></li>
  <li><a href="#big"><cite>大号进度条</cite></a></li>
  <li><a href="../modules/element.html#progress"><cite>相关动态操作</cite></a></li>
</ul>
<div class="layui-container layui-row">
  
<div class="layui-col-md3">
  <div class="layui-panel site-menu">
    <ul class="layui-menu layui-menu-lg">
      <li class="layui-menu-item-group" lay-options="{type: 'group', isAllowSpread: true}">
        <div class="layui-menu-body-title">
          基础说明
        </div>
        <hr>
        <ul>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../index.html">
                <span>开始使用 </span> 
                <span class="layui-font-12 layui-font-gray">Getting Started</span>
              </a>
              
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../base/infrastructure.html">
                <span>底层方法 </span>
                <span class="layui-font-12 layui-font-gray">基础支撑</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../base/element.html">
                <span>页面元素 </span>
                <span class="layui-font-12 layui-font-gray">规范 公共类 属性</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../base/modules.html">
                <span>模块规范 </span>
                <span class="layui-font-12 layui-font-gray">使用 扩展</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../base/faq.html">
                <span>常见问题 </span>
                <span class="layui-font-12 layui-font-gray">FAQ</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../base/changelog.html">
                <span>更新日志 </span>
                <span class="layui-font-12 layui-font-gray">changelog</span>
                
                  <span class="layui-badge-dot"></span>
                
              </a>
            </div>
          </li>
        </ul>
      </li>
      
      <li class="layui-menu-item-group" lay-options="{type: 'group', isAllowSpread: true}">
        <div class="layui-menu-body-title">
          页面元素
        </div>
        <hr>
        <ul>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="layout.html">
                <span>布局 </span>
                <span class="layui-font-12 layui-font-gray">栅格 后台管理布局</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="color.html">
                <span>颜色 </span>
                <span class="layui-font-12 layui-font-gray">主色调 颜色搭配</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="icon.html">
                <span>图标 </span>
                <span class="layui-font-12 layui-font-gray">iconfont 字体图标</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="anim.html">
                <span>动画 </span>
                <span class="layui-font-12 layui-font-gray">内置 CSS3 动画</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="button.html">
                <span>按钮 </span>
                <span class="layui-font-12 layui-font-gray">button</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="form.html">
                <span>表单 </span>
                <span class="layui-font-12 layui-font-gray">form 元素集合</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="nav.html">
                <span>导航 </span>
                <span class="layui-font-12 layui-font-gray">nav 面包屑</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="menu.html">
                <span>菜单 </span>
                <span class="layui-font-12 layui-font-gray">menu 基础菜单</span>
                
                  <span class="layui-badge-dot"></span>
                
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="tab.html">
                <span>选项卡 </span>
                <span class="layui-font-12 layui-font-gray">Tabs 切换</span>
              </a>
            </div>
          </li>
          <li class="layui-menu-item-checked2">
            <div class="layui-menu-body-title">
              <a href="">
                <span>进度条 </span>
                <span class="layui-font-12 layui-font-gray">progress</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="panel.html">
                <span>面板 </span>
                <span class="layui-font-12 layui-font-gray">panel 卡片 折叠</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="table.html">
                <span>表格 </span>
                <span class="layui-font-12 layui-font-gray">静态 table</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="badge.html">
                <span>徽章 </span>
                <span class="layui-font-12 layui-font-gray">小圆点  小边框</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="timeline.html">
                <span>时间线 </span>
                <span class="layui-font-12 layui-font-gray">timeline</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="auxiliar.html">
                <span>辅助 </span>
                <span class="layui-font-12 layui-font-gray">引用 字段集 横线等</span>
              </a>
            </div>
          </li>
        </ul>
      </li>
      
      <li class="layui-menu-item-group" lay-options="{type: 'group', isAllowSpread: true}">
        <div class="layui-menu-body-title">
          内置模块
        </div>
        <hr>
        <ul>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../modules/layer.html">
                <span>弹出层 </span>
                <span class="layui-font-12 layui-font-gray">layer</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../modules/laydate.html">
                <span>日期与时间选择 </span>
                <span class="layui-font-12 layui-font-gray">laydate</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../modules/laypage.html">
                <span>分页 </span>
                <span class="layui-font-12 layui-font-gray">laypage</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../modules/laytpl.html">
                <span>模板引擎 </span>
                <span class="layui-font-12 layui-font-gray">laytpl</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../modules/table.html">
                <span>数据表格 </span>
                <span class="layui-font-12 layui-font-gray">table</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../modules/form.html">
                <span>表单 </span>
                <span class="layui-font-12 layui-font-gray">form</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../modules/upload.html">
                <span>文件上传 </span>
                <span class="layui-font-12 layui-font-gray">upload</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../modules/dropdown.html">
                <span>下拉菜单 </span>
                <span class="layui-font-12 layui-font-gray">dropdown</span>
                
                  <span class="layui-badge-dot"></span>
                
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../modules/transfer.html">
                <span>穿梭框 </span>
                <span class="layui-font-12 layui-font-gray">transfer</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../modules/tree.html">
                <span>树形组件 </span>
                <span class="layui-font-12 layui-font-gray">tree</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../modules/colorpicker.html">
                <span>颜色选择器 </span>
                <span class="layui-font-12 layui-font-gray">colorpicker</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../modules/element.html">
                <span>常用元素操作 </span>
                <span class="layui-font-12 layui-font-gray">element</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../modules/slider.html">
                <span>滑块 </span>
                <span class="layui-font-12 layui-font-gray">slider</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../modules/rate.html">
                <span>评分 </span>
                <span class="layui-font-12 layui-font-gray">rate</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../modules/carousel.html">
                <span>轮播 </span>
                <span class="layui-font-12 layui-font-gray">carousel</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../modules/flow.html">
                <span>流加载 </span>
                <span class="layui-font-12 layui-font-gray">flow</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../modules/util.html">
                <span>工具组件 </span>
                <span class="layui-font-12 layui-font-gray">util</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../modules/code.html">
                <span>代码高亮显示 </span>
                <span class="layui-font-12 layui-font-gray">code</span>
              </a>
            </div>
          </li>
        </ul>
      </li>
    </ul>
  </div>
  <div class="layui-hide-v"> - </div>
</div>

  
  <div class="layui-col-md9 site-content">
    <h1 class="site-h1">进度条 - 页面元素</h1>
    <blockquote class="site-text layui-elem-quote">
      进度条可应用于许多业务场景，如任务完成进度、loading等等，是一种较为直观的表达元素。
    </blockquote>
    <blockquote class="site-text layui-elem-quote">
      依赖加载组件：<a href="../modules/element.html">element</a>
    </blockquote>
    
    
    
    
    <div class="site-title">
      <fieldset><legend><a name="default">常规用法</a></legend></fieldset>
    </div>    
    <div class="site-text">
      
      <div class="layui-progress">
        <div class="layui-progress-bar" lay-percent="20%"></div>
      </div>
      <br>
      <div class="layui-progress">
        <div class="layui-progress-bar layui-bg-orange" lay-percent="50%"></div>
      </div>
      <br>
      <div class="layui-progress" lay-showpercent="true">
        <div class="layui-progress-bar layui-bg-blue" lay-percent="80%"></div>
      </div>
      <br>
      <div class="layui-progress layui-progress-big" lay-showpercent="true">
        <div class="layui-progress-bar layui-bg-cyan" lay-percent="30%"></div>
      </div>
      
      <br>
      <p>我们进度条提供了两种尺寸及多种颜色的显示风格，其中颜色的选值可参考：<a href="../base/element.html#css">背景色公共类</a>。基本元素结构如下</p>
      
      <pre class="layui-code" lay-title="HTML结构">
&lt;div class=&quot;layui-progress&quot;&gt;
  &lt;div class=&quot;layui-progress-bar&quot; <a>lay-percent=&quot;10%&quot;</a>&gt;&lt;/div&gt;
&lt;/div&gt;
 
&lt;script&gt;
//注意进度条依赖 element 模块，否则无法进行正常渲染和功能性操作
layui.use('element', function(){
  var element = layui.element;
});
&lt;/script&gt;
      </pre>
      
      <p>
        属性 <em>lay-percent</em> ：代表进度条的初始百分比，你也可以动态改变进度，详见：<a href="../modules/element.html#progress">进度条的动态操作</a>
      </p>
      <p>正如上述你见到的，当对元素设置了class为 <em>layui-progress-big</em> 时，即为大尺寸的进度条风格。默认风格的进度条的百分比如果开启，会在右上角显示，而大号进度条则会在内部显示。</p>
    </div>
    
    <div class="site-title">
      <fieldset><legend><a name="showPercent">显示进度比文本</a></legend></fieldset>
    </div>    
    <div class="site-text">
      <div class="layui-progress" lay-showpercent="true">
        <div class="layui-progress-bar layui-bg-red" lay-percent="1/3"></div>
      </div>
      <br><br>
      <div class="layui-progress" lay-showpercent="true">
        <div class="layui-progress-bar layui-bg-red" lay-percent="80%"></div>
      </div>
      <br>
      <div class="layui-progress layui-progress-big" lay-showpercent="true">
        <div class="layui-progress-bar layui-bg-green" lay-percent="50%"></div>
      </div>
      
      <br>
      <p>通过对父级元素设置属性 <em>lay-showPercent="yes"</em> 来开启进度比的文本显示，支持：<em>普通数字</em>、<em>百分数</em>、<em>分数</em>（layui 2.1.7 新增）</p>
      
      <pre class="layui-code" lay-title="HTML结构">
&lt;div class=&quot;layui-progress&quot; lay-showPercent=&quot;true&quot;&gt;
  &lt;div class=&quot;layui-progress-bar layui-bg-red&quot; lay-percent=&quot;1/3&quot;&gt;&lt;/div&gt;
&lt;/div&gt;
       
&lt;div class=&quot;layui-progress&quot; <a>lay-showPercent=&quot;yes&quot;</a>&gt;
  &lt;div class=&quot;layui-progress-bar layui-bg-red&quot; lay-percent=&quot;30%&quot;&gt;&lt;/div&gt;
&lt;/div&gt;
 
&lt;div class=&quot;layui-progress layui-progress-big&quot; <a>lay-showPercent=&quot;yes&quot;</a>&gt;
  &lt;div class=&quot;layui-progress-bar layui-bg-green&quot; lay-percent=&quot;50%&quot;&gt;&lt;/div&gt;
&lt;/div&gt;
      </pre>
      <p>注意：默认情况下不会显示百分比文本，如果你想开启，对属性lay-showPercent设置任意值即可，如：yes。但如果不想显示，千万别设置no或者false，直接剔除该属性即可。</p>
    </div>
    
    <div class="site-title">
      <fieldset><legend><a name="big">大号进度条</a></legend></fieldset>
    </div>    
    <div class="site-text">
      
      <div class="layui-progress layui-progress-big">
        <div class="layui-progress-bar" lay-percent="20%"></div>
      </div>
      <br>
      <div class="layui-progress layui-progress-big">
        <div class="layui-progress-bar layui-bg-orange" lay-percent="50%"></div>
      </div>
      <br>
      <div class="layui-progress layui-progress-big" lay-showpercent="true">
        <div class="layui-progress-bar layui-bg-blue" lay-percent="80%"></div>
      </div>
      
      <br>
      <p>和世界上许多客观存在的事物一样，进度条也不仅是只有短小细长的尺寸，当然也有大而粗，这是我们认为相对合适的大尺寸。</p>
      
      <pre class="layui-code" lay-title="HTML结构">
&lt;div class=&quot;layui-progress <a>layui-progress-big</a>&quot;&gt;
  &lt;div class=&quot;layui-progress-bar&quot; lay-percent=&quot;20%&quot;&gt;&lt;/div&gt;
&lt;/div&gt;
 
&lt;div class=&quot;layui-progress <a>layui-progress-big</a>&quot;&gt;
  &lt;div class=&quot;layui-progress-bar layui-bg-orange&quot; lay-percent=&quot;50%&quot;&gt;&lt;/div&gt;
&lt;/div&gt;
 
&lt;div class=&quot;layui-progress <a>layui-progress-big</a>&quot; lay-showPercent=&quot;true&quot;&gt;
  &lt;div class=&quot;layui-progress-bar layui-bg-blue&quot; lay-percent=&quot;80%&quot;&gt;&lt;/div&gt;
&lt;/div&gt;
      </pre>
      <p>正如上述你见到的，当对元素设置了class为 layui-progress-big 时，即为大尺寸的进度条风格。默认风格的进度条的百分比如果开启，会在右上角显示，而大号进度条则会在内部显示。</p>
      <p>如果你需要对进度条进行动态操作，如动态改变进度，那么你需要阅读：<a href="../modules/element.html">element模块</a></p>
    </div>
    
    
    <div class="layui-elem-quote">
  <p>layui - 在每一个细节中，用心与你沟通</p>
</div>
    
  </div>
</div>
<script>
window.global = {
  pageType: 'doc'
  ,preview: function(){
    var preview = document.getElementById('LAY_preview');
    return preview ? preview.innerHTML : '';
  }()
};
</script>
<script async="" src="../../pagead/js/adsbygoogle.js"></script>
<div class="site-tree-mobile layui-hide">
  <i class="layui-icon layui-icon-spread-left"></i>
</div>
<div class="site-mobile-shade"></div>
 
<script src="../../layui/dist/layui.js" ></script>
<script>
layui.config({
  base: '../../static/lay/modules/layui/'
  ,version: '1632428048355'
}).use('global');
</script>
 <script>
layui.use(['element', 'layer'], function(){
  var element = layui.element
  ,layer = layui.layer;
  
  element.on('tab(docDemoTabBrief)', function(data){
    layer.msg('切到到了'+ data.index + '：' + this.innerHTML);
  });
});
</script>
</body>
</html>